#!/bin/bash

#set -o pipefail
set -o errexit
export LC_ALL=C

BASE_ANN_DIR=$1
GENE_ID=$2

export BASE_DATE=$(head -n1 ${BASE_ANN_DIR}/base_date.txt)
# export BASE_DATA_PATH=/home/mixagol/data/
export BASE_DATA_PATH=/home/mixagol/data2/

source 6_annotation/annotate_common.sh

# NORM_MATRIX_DIR=${BASE_DATA_PATH}/4_normed_matrix/${BASE_DATE}/wu_blast_nw # full
# NORM_MATRIX_DIR=${BASE_DATA_PATH}/4_normed_matrix/${BASE_DATE}/wu_blast_nw_excl_NC_010163 # a.laidlawii
NORM_MATRIX_DIR=${BASE_DATA_PATH}/4_normed_matrix/${BASE_DATE}/wu_blast_nw_excl_NC_010102 # s.enterica
# NORM_MATRIX_DIR=${BASE_DATA_PATH}/4_normed_matrix/${BASE_DATE}/wu_blast_nw_excl_NC_012883 # t.sibiricus
GENOMES_NUM=`cat "${NORM_MATRIX_DIR}/map_int_genom.txt" | wc -l`

ANNOTATE_DIR=${BASE_ANN_DIR}/annot_$(date +%s.%N)
mkdir -p $ANNOTATE_DIR

EXCL_GENOMES=$(head -n1 ${BASE_ANN_DIR}/excl_genomes.txt)

read_and_prepare_input          $ANNOTATE_DIR   $GENE_ID
find_local_alignments_wu_blast  $ANNOTATE_DIR
find_global_alignments_nw       $ANNOTATE_DIR

